package com.zry.fertilizer.utils

import com.zry.fertilizer.been.LoginInfoBean

class ACacheUtil {


    fun setLoginInfo(loginInfoBean: LoginInfoBean) {
        SpUtil().putObject(ToastUtil.getContext(), "loginInfoBean", loginInfoBean)
    }

    fun setUsername(username: String) {
        SpUtil().putString(ToastUtil.getContext(), "username", username)
    }

    fun setPassword(password: String) {
        SpUtil().putString(ToastUtil.getContext(), "password", password)
    }

    fun getLoginInfo(): LoginInfoBean {
        return SpUtil().getObject(ToastUtil.getContext(), "loginInfoBean")!!
    }

    fun getUsername(): String {
        return SpUtil().getString(ToastUtil.getContext(), "username")
    }

    fun getPassword(): String {
        return SpUtil().getString(ToastUtil.getContext(), "password")
    }


    fun deleteLoginInfo() {
        SpUtil().deleteData(ToastUtil.getContext(), "loginInfoBean")
    }

    fun deleteUserName() {
        SpUtil().deleteData(ToastUtil.getContext(), "username")
    }

    fun deletePassword() {
        SpUtil().deleteData(ToastUtil.getContext(), "password")
    }

    fun clear() {
        SpUtil().clearData(ToastUtil.getContext())
    }

}